×

js特效下载 s js

有图片轮换的js特效,下载到本地之后,我再做网站的时候需要这个js特效的话我应该在什么地方加什么代码?C#窗体中如何让messagebox上显示自定义按钮

admin admin 发表于2022-04-29 12:39:23 浏览147 评论0

抢沙发发表评论

有图片轮换的js特效,下载到本地之后,我再做网站的时候需要这个js特效的话我应该在什么地方加什么代码

你去看看你你下载过来的这个插件文件夹下是否有一个使用说明,如果有按照要求写代码。如果没有,你就查看特效的源文件,然后把你的代码改成他提供的源文件的格式和样子,然后用script标签的src属性将插件js文件引入你的页面当中

C#窗体中如何让messagebox上显示自定义按钮

DialogResult dr= MessageBox.Show(“内容?“,“对话框标题“, MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dr == DialogResult.OK) { //点确定的代码 } else { //点取消的代码 }

如何使用旋转动画和帧动画实现自定义ProgressDialog

第一步:自定义progressDialog的样式 progress_dialog_layout.xml[html] view plain copy 《?xml version=“1.0“ encoding=“utf-8“?》 《RelativeLayout xmlns:android=“android:layout_width=“match_parent“ android:layout_height=“match_parent“》 《ImageView android:id=“@+id/refreshing_img“ android:layout_width=“wrap_content“ android:layout_height=“wrap_content“ android:layout_centerInParent=“true“ android:scaleType=“fitCenter“ android:src=“@drawable/icon_progress_dialog“ /》 《/RelativeLayout》 第二步:在styles.xml文件中定义ProgressDialog的主题为:无边框全透明背景[html] view plain copy 《resources》 《!--自定义dialog背景全透明无边框theme --》 《style name=“MyDialog“ parent=“android:style/Theme.Dialog“》 《!--背景颜色及和透明程度--》 《item name=“android:windowBackground“》@android:color/transparent《/item》 《!--是否去除标题 --》 《item name=“android:windowNoTitle“》true《/item》 《!--是否去除边框--》 《item name=“android:windowFrame“》@null《/item》 《!--是否浮现在activity之上--》 《item name=“android:windowIsFloating“》true《/item》 《!--是否模糊--》 《item name=“android:backgroundDimEnabled“》false《/item》 《/style》 《/resources》 第三部:在anim文件夹下,定义旋转动画的样式,这里定义了动画旋转时间为0.7秒,从0到359度,若设置成360度在停止时会出现停顿现象。动画的插值器为先加速后减速,旋转的中心点为imageView的自身中心点。然后repeateCount为重复次数,这里设置为 -1 ,表示无限重复。动画progress_rotate.xml 如下:[html] view plain copy 《?xml version=“1.0“ encoding=“utf-8“?》 《set xmlns:android=“《!--设置动画渲染器为先加速在减速(开始速度最快 逐渐减慢)--》 《rotate android:duration=“700“ android:fromDegrees=“0“ android:interpolator=“@android:anim/accelerate_decelerate_interpolator“ android:pivotX=“50%“ android:pivotY=“50%“ android:repeatCount=“-1“ android:toDegrees=“359“ /》 《/set》 这里顺便讲解下动画的属性,加深下印象:android:fromDegrees 起始的角度度数android:toDegrees 结束的角度度数,负数表示逆时针,正数表示顺时针android:pivotX 旋转中心的X坐标浮点数或是百分比。浮点数表示相对于Object的左边缘,如5; 百分比表示相对于Object的左边缘,如5%; 另一种百分比表示相对于父容器的左边缘,如5%p; 一般设置为50%表示在Object中心android:pivotY 旋转中心的Y坐标浮点数或是百分比。浮点数表示相对于Object的上边缘,如5; 百分比表示相对于Object的上边缘,如5%; 另一种百分比表示相对于父容器的上边缘,如5%p; 一般设置为50%表示在Object中心android:duration 表示从android:fromDegrees转动到android:toDegrees所花费的时间,单位为毫秒。可以用来计算速度。android:interpolator表示变化率,但不是运行速度。一个插补属性,可以将动画效果设置为加速,减速,反复,反弹等。默认为开始和结束慢中间快,android:startOffset 在调用start函数之后等待开始运行的时间,单位为毫秒,若为10,表示10ms后开始运行android:repeatCount 重复的次数,默认为0,必须是int,可以为-1表示不停止android:repeatMode 重复的模式,默认为restart,即重头开始重新运行,可以为reverse即从结束开始向前重新运行。在android:repeatCount大于0或为infinite时生效android:detachWallpaper 表示是否在壁纸上运行android:zAdjustment 表示被animated的内容在运行时在z轴上的位置,默认为normal。normal保持内容当前的z轴顺序top运行时在最顶层显示bottom运行时在最底层显示在操作开始之前调用if (drawableAnim != null) { imageView.startAnimation(drawableAnim); } 操作完成时调用 drawableAnim.clearAnimation();第四部:继承AlertDialog实现自定义的ProgressDialog,如下:d[java] view plain copy package com.example.myfirst.refreshdialog; import android.content.Context; import android.os.Bundle; import android.support.v7.app.AlertDialog; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.ImageView; /** * 自定义过场动画,主要用户数据加载时,显示等待progress * Created by 程果 on 2016/3/16. */ public class ProgressAlertDialog extends AlertDialog { private ImageView progressImg; //旋转动画 private Animation animation; public ProgressAlertDialog(Context context) { super(context, R.style.MyDialog); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.progress_dialog_layout); //点击imageview外侧区域,动画不会消失 setCanceledOnTouchOutside(false); progressImg = (ImageView) findViewById(R.id.refreshing_img); //加载动画资源 animation = AnimationUtils.loadAnimation(getContext(), R.anim.progress_rotate); //动画完成后,是否保留动画最后的状态,设为true animation.setFillAfter(true); } /** * 在AlertDialog的 onStart() 生命周期里面执行开始动画 */ @Override protected void onStart() { super.onStart(); if( animation != null){ progressImg.startAnimation(animation); [java] view plain copy } } /** * 在AlertDialog的onStop()生命周期里面执行停止动画 */ @Override protected void onStop() { super.onStop(); progressImg.clearAnimation(); } } 效果gif图如下:第二种使用 帧动画实现自定义ProgressDialog,第一步:也是定义动画布局progress_drawable_dialog_layout.xml文件,如下:[html] view plain copy 《?xml version=“1.0“ encoding=“utf-8“?》 《RelativeLayout xmlns:android=“android:layout_width=“match_parent“ android:layout_height=“match_parent“》 《ImageView android:id=“@+id/refreshing_drawable_img“ android:layout_width=“wrap_content“ android:layout_height=“wrap_content“ android:layout_centerInParent=“true“ android:scaleType=“fitCenter“ android:src=“@drawable/drawable_anim“ /》 《/RelativeLayout》 第二步:在drawable文件下面定义帧动画,这就比旋转动画简单点,如下只有两个熟悉,单帧图片和它显示的时间:[java] view plain copy 《?xml version=“1.0“ encoding=“utf-8“?》 《animation-list xmlns:android=“《item android:drawable=“@mipmap/img2“ android:duration=“200“ /》 《item android:drawable=“@mipmap/img3“ android:duration=“200“ /》 《item android:drawable=“@mipmap/img4“ android:duration=“200“ /》 《item android:drawable=“@mipmap/img5“ android:duration=“200“ /》 《item android:drawable=“@mipmap/img6“ android:duration=“200“ /》 《item android:drawable=“@mipmap/img7“ android:duration=“200“ /》 《item android:drawable=“@mipmap/img1“ android:duration=“200“ /》 《/animation-list》 第三部:也是使用旋转动画中的AlertDialog主题;第四部:继承AlertDialog实现自定义的帧动画ProgressDialog:[java] view plain copy package com.example.myfirst.refreshdialog; import android.content.Context; import android.graphics.drawable.AnimationDrawable; import android.os.Bundle; import android.support.v7.app.AlertDialog; import android.widget.ImageView; /** * 自定义过场动画,主要用户数据加载时,显示等待progress * Created by 程果 on 2016/3/16. */ public class ProgressDrawableAlertDialog extends AlertDialog { private ImageView progressImg; //帧动画 private AnimationDrawable animation; public ProgressDrawableAlertDialog(Context context) { super(context, R.style.MyDialog); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.progress_drawable_dialog_layout); //点击imageview外侧区域,动画不会消失 setCanceledOnTouchOutside(false); progressImg = (ImageView) findViewById(R.id.refreshing_drawable_img); //加载动画资源 animation = (AnimationDrawable) progressImg.getDrawable(); } /** * 在AlertDialog的 onStart() 生命周期里面执行开始动画 */ @Override protected void onStart() { super.onStart(); animation.start(); } /** * 在AlertDialog的onStop()生命周期里面执行停止动画 */ @Override protected void onStop() { super.onStop(); animation.stop(); } }