当前位置: 首页 > news >正文

杭州知名网站建设百度开户要多少钱

杭州知名网站建设,百度开户要多少钱,wordpress更改页面图片链接,wordpress 虚拟商品插件目录 📂 前言 AR 眼镜系统版本 拍照/录像动效切换 1. 🔱 技术方案 1.1 技术方案概述 1.2 实现方案 1)第一阶段动效 2)第二阶段动效 2. 💠 默认代码配置 2.1 XML 初始布局 2.2 监听滑动对 View 改变 3. ⚛️…

目录

📂 前言

AR 眼镜系统版本

拍照/录像动效切换

1. 🔱 技术方案

1.1 技术方案概述

1.2 实现方案

1)第一阶段动效

2)第二阶段动效

2. 💠 默认代码配置

2.1 XML 初始布局

2.2 监听滑动对 View 改变

3. ⚛️ 拍照/录像动效切换实现

3.1 第一阶段动效

1)左移右边部分的 View

2)放大右边部分的 View

3.2 第二阶段动效

1)动态调整右边部分的约束

2)缩小右边部分的 View

3)从左往右移动左边部分

4)从 0 到 1 透明度增加左边部分

5)动画集实现

6)还原默认约束

4. ✅ 小结

附录1:动效帮助类代码


📂 前言

AR 眼镜系统版本

        W517 Android9。

拍照/录像动效切换

        实现效果如上 GIF 的左下角所示,我们看到主要分为:两部分、两阶段。

        两部分:左边部分为 Normal 状态 View,右边部分为带有文字描述的 View。

        两阶段:右边部分,分为变大阶段、缩小阶段;在右边部分的第二缩小阶段时,会触发左边部分的从左往右移动阶段、从 0 到 1 透明度增加阶段。

1. 🔱 技术方案

1.1 技术方案概述

        拍照/录像动效切换主要使用属性动画完成,同时对于放大和缩小的参考方向不同,所以需要动态调整约束,动态调整约束时还需注意 maigin 值,因为文字改变尺寸也会变化。

1.2 实现方案

1)第一阶段动效
  1. 左移右边部分的 View;

  2. 放大右边部分的 View。

2)第二阶段动效
  1. 动态调整右边部分的约束;

  2. 缩小右边部分的 View;

  3. 从左往右移动左边部分;

  4. 从 0 到 1 透明度增加左边部分。

2. 💠 默认代码配置

2.1 XML 初始布局

        norIcon 是左边部分 View,focLayout 是右边部分 View。

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"xmlns:tools="http://schemas.android.com/tools"android:id="@+id/parent"android:layout_width="match_parent"android:layout_height="match_parent"android:keepScreenOn="true"><ImageViewandroid:id="@+id/norIcon"android:layout_width="80dp"android:layout_height="104dp"android:layout_marginStart="24dp"android:layout_marginBottom="24dp"android:background="@drawable/shape_34343a_corner_20dp"android:contentDescription="@null"android:paddingHorizontal="24dp"android:paddingVertical="36dp"android:src="@drawable/ic_camera_video_nor"app:layout_constraintBottom_toBottomOf="parent"app:layout_constraintStart_toStartOf="parent" /><LinearLayoutandroid:id="@+id/focLayout"android:layout_width="wrap_content"android:layout_height="104dp"android:layout_marginStart="110dp"android:background="@drawable/shape_34343a_corner_20dp"android:gravity="center"android:minWidth="200dp"android:orientation="vertical"android:paddingStart="12dp"android:paddingEnd="16dp"app:layout_constraintBottom_toBottomOf="@id/norIcon"app:layout_constraintStart_toStartOf="parent"><ImageViewandroid:id="@+id/focIcon"android:layout_width="32dp"android:layout_height="32dp"android:contentDescription="@null"android:src="@drawable/ic_camera_picture_foc" /><com.agg.ui.AGGTextViewandroid:id="@+id/focText"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginTop="6dp"android:gravity="center"android:singleLine="true"android:text="@string/tap_to_photo"android:textColor="#FCC810"android:textSize="24sp"app:UITypeface="Bold" /></LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

2.2 监听滑动对 View 改变

    /*** 往前滑动:切换为录像模式/拍照模式*/override fun scrollForward() {if (AnimatorSwitchHelper.isAnimating) {Log.e(TAG, "scrollForward: 滑动过快")return}Log.i(TAG, "scrollForward: model=$mIsVideoModel,isRecordingVideo=${isRecording()}")if (mIsVideoModel) {if (isRecording()) stopRecord()switchToPhoto()mIsVideoModel = falsebinding.tips.text = getString(R.string.swipe_forward_to_video_model)binding.norIcon.setImageResource(R.drawable.ic_camera_video_nor)binding.focIcon.setImageResource(R.drawable.ic_camera_picture_foc)binding.focText.text = getString(R.string.tap_to_photo)} else {switchToVideo()mIsVideoModel = truebinding.tips.text = getString(R.string.swipe_forward_to_photo_model)binding.norIcon.setImageResource(R.drawable.ic_camera_picture_nor)binding.focIcon.setImageResource(R.drawable.ic_camera_video_foc)binding.focText.text = getString(R.string.tap_to_record)}binding.tips.visibility = VISIBLEAnimatorSwitchHelper.startAnimator(binding)}

3. ⚛️ 拍照/录像动效切换实现

3.1 第一阶段动效

1)左移右边部分的 View
binding.focLayout.x = binding.focLayout.x - 86
2)放大右边部分的 View
val defWidth = binding.focLayout.width
val focBgBigAnim = ValueAnimator.ofInt(defWidth, defWidth + 86).apply {addUpdateListener { animation ->val width = animation.animatedValue as Intval layoutParams = binding.focLayout.layoutParams as ViewGroup.LayoutParamslayoutParams.width = widthbinding.focLayout.layoutParams = layoutParams}}

3.2 第二阶段动效

1)动态调整右边部分的约束

        第一阶段在 XML 中默认配置的是 layout_constraintStart_toStartOf="parent",能保证放大时以左边为锚点从左往右放大;而第二阶段缩小时需要以右边为锚点,此时需要动态改变约束如下:

private fun changeConstraint(binding: ActivityMainBinding) {Log.i(TAG, "changeConstraint: ")val focLayoutId = R.id.focLayoutval constraintLayout = binding.parentConstraintSet().apply {// 修改约束clone(constraintLayout)// 清除原有的约束clear(focLayoutId, ConstraintSet.START)// 设置新的约束connect(focLayoutId,ConstraintSet.END,ConstraintSet.PARENT_ID,ConstraintSet.END,(binding.focLayout.context.resources.displayMetrics.widthPixels - binding.focLayout.x - binding.focLayout.width - 86).toInt())// 自动播放过渡动画——取消播放,与自定义动画重复
//            TransitionManager.beginDelayedTransition(constraintLayout)// 应用新的约束applyTo(constraintLayout)}
}
2)缩小右边部分的 View
val focBgSmallAnim = ValueAnimator.ofInt(defWidth + 86, defWidth).apply {addUpdateListener { animation ->val width = animation.animatedValue as Intval layoutParams = binding.focLayout.layoutParams as ViewGroup.LayoutParamslayoutParams.width = widthbinding.focLayout.layoutParams = layoutParams}addListener(object : AnimatorListenerAdapter() {override fun onAnimationEnd(p0: Animator) {Log.i(TAG, "onAnimationEnd: focBgSmallAnim")isAnimating = false}})
}
3)从左往右移动左边部分
val norBgTransAnim = ObjectAnimator.ofFloat(binding.norIcon, "translationX", -80f, 0f)
4)从 0 到 1 透明度增加左边部分
val norBgAlphaAnim = ObjectAnimator.ofFloat(binding.norIcon, "alpha", 0f, 1f)
5)动画集实现
AnimatorSet().apply {playSequentially(focBgBigAnim, focBgSmallAnim)playTogether(focBgSmallAnim, norBgTransAnim, norBgAlphaAnim)duration = 1000start()
}
6)还原默认约束

        动效做完后需要还原默认约束,保证下次动效的正常进行。

if (!isFirstSwitch) restoreConstraint(binding)private fun restoreConstraint(binding: ActivityMainBinding) {Log.i(TAG, "restoreConstraint: ")val focLayoutId = R.id.focLayoutval constraintLayout = binding.parentConstraintSet().apply {clone(constraintLayout)clear(focLayoutId, ConstraintSet.END)connect(focLayoutId, ConstraintSet.START, ConstraintSet.PARENT_ID, ConstraintSet.START, 110)applyTo(constraintLayout)}
}

        具体动效类的代码,参考附录1。

4. ✅ 小结

        对于拍照/录像动效切换,本文只是一个基础实现方案,更多业务细节请参考产品逻辑去实现。

        另外,由于本人能力有限,如有错误,敬请批评指正,谢谢。


附录1:动效帮助类代码

object AnimatorSwitchHelper {private val TAG = AnimatorSwitchHelper::class.java.simpleNamevar isAnimating = falsevar isFirstSwitch = truefun startAnimator(binding: ActivityMainBinding) {Log.i(TAG, "startAnimator: isAnimating=$isAnimating,isFirstSwitch=$isFirstSwitch")isAnimating = trueval defWidth = binding.focLayout.widthif (!isFirstSwitch) restoreConstraint(binding)if (isFirstSwitch) binding.focLayout.x = binding.focLayout.x - 86// 1. 放大Foc的Viewval focBgBigAnim = ValueAnimator.ofInt(defWidth, defWidth + 86).apply {addUpdateListener { animation ->val width = animation.animatedValue as Intval layoutParams = binding.focLayout.layoutParams as ViewGroup.LayoutParamslayoutParams.width = widthbinding.focLayout.layoutParams = layoutParams}addListener(object : AnimatorListenerAdapter() {override fun onAnimationEnd(p0: Animator) {Log.i(TAG, "onAnimationEnd: focBgBigAnim")// 为绘制反向动画,需修改约束方向changeConstraint(binding)isFirstSwitch = false}})}// 2.1 缩小Foc的Viewval focBgSmallAnim = ValueAnimator.ofInt(defWidth + 86, defWidth).apply {addUpdateListener { animation ->val width = animation.animatedValue as Intval layoutParams = binding.focLayout.layoutParams as ViewGroup.LayoutParamslayoutParams.width = widthbinding.focLayout.layoutParams = layoutParams}addListener(object : AnimatorListenerAdapter() {override fun onAnimationEnd(p0: Animator) {Log.i(TAG, "onAnimationEnd: focBgSmallAnim")isAnimating = false}})}// 2.2 从左往右移动Nor的Viewval norBgTransAnim = ObjectAnimator.ofFloat(binding.norIcon, "translationX", -80f, 0f)// 2.3 透明度渐显Nor的Viewval norBgAlphaAnim = ObjectAnimator.ofFloat(binding.norIcon, "alpha", 0f, 1f)AnimatorSet().apply {playSequentially(focBgBigAnim, focBgSmallAnim)playTogether(focBgSmallAnim, norBgTransAnim, norBgAlphaAnim)duration = 1000start()}}private fun changeConstraint(binding: ActivityMainBinding) {Log.i(TAG, "changeConstraint: ")val focLayoutId = R.id.focLayoutval constraintLayout = binding.parentConstraintSet().apply {// 修改约束clone(constraintLayout)// 清除原有的约束clear(focLayoutId, ConstraintSet.START)// 设置新的约束connect(focLayoutId,ConstraintSet.END,ConstraintSet.PARENT_ID,ConstraintSet.END,(binding.focLayout.context.resources.displayMetrics.widthPixels - binding.focLayout.x - binding.focLayout.width - 86).toInt())// 自动播放过渡动画——取消播放,与自定义动画重复
//            TransitionManager.beginDelayedTransition(constraintLayout)// 应用新的约束applyTo(constraintLayout)}}private fun restoreConstraint(binding: ActivityMainBinding) {Log.i(TAG, "restoreConstraint: ")val focLayoutId = R.id.focLayoutval constraintLayout = binding.parentConstraintSet().apply {clone(constraintLayout)clear(focLayoutId, ConstraintSet.END)connect(focLayoutId, ConstraintSet.START, ConstraintSet.PARENT_ID, ConstraintSet.START, 110)applyTo(constraintLayout)}}}


文章转载自:
http://dinncocinerator.ydfr.cn
http://dinncodeckhead.ydfr.cn
http://dinncojuke.ydfr.cn
http://dinncohurly.ydfr.cn
http://dinncodeclarator.ydfr.cn
http://dinncooffenceful.ydfr.cn
http://dinncotribolet.ydfr.cn
http://dinncotriennium.ydfr.cn
http://dinncobenchboard.ydfr.cn
http://dinncoplata.ydfr.cn
http://dinncospenglerian.ydfr.cn
http://dinncosulfite.ydfr.cn
http://dinncowrangel.ydfr.cn
http://dinncobradypepsia.ydfr.cn
http://dinncosofa.ydfr.cn
http://dinncomassage.ydfr.cn
http://dinncounderarmed.ydfr.cn
http://dinncohellweed.ydfr.cn
http://dinncospittle.ydfr.cn
http://dinncobalmoral.ydfr.cn
http://dinncovibrational.ydfr.cn
http://dinncoconsonance.ydfr.cn
http://dinncodelightful.ydfr.cn
http://dinncoafraid.ydfr.cn
http://dinncopygmy.ydfr.cn
http://dinncodryasdust.ydfr.cn
http://dinncobituminize.ydfr.cn
http://dinncoindefinable.ydfr.cn
http://dinncoflaunty.ydfr.cn
http://dinncoskish.ydfr.cn
http://dinncofussock.ydfr.cn
http://dinncodissected.ydfr.cn
http://dinncopaleness.ydfr.cn
http://dinncoesotropia.ydfr.cn
http://dinncotamable.ydfr.cn
http://dinncoscreenings.ydfr.cn
http://dinncorowdyish.ydfr.cn
http://dinnconondurable.ydfr.cn
http://dinncoregula.ydfr.cn
http://dinncounilingual.ydfr.cn
http://dinncohealthily.ydfr.cn
http://dinncororschach.ydfr.cn
http://dinncoaeroengine.ydfr.cn
http://dinncoypsce.ydfr.cn
http://dinncohoard.ydfr.cn
http://dinncoroughy.ydfr.cn
http://dinncorejasing.ydfr.cn
http://dinncohairnet.ydfr.cn
http://dinncoament.ydfr.cn
http://dinncosunbeam.ydfr.cn
http://dinncocommis.ydfr.cn
http://dinncoagiotage.ydfr.cn
http://dinncohatband.ydfr.cn
http://dinncodenominal.ydfr.cn
http://dinncocurvilinear.ydfr.cn
http://dinncolapidarian.ydfr.cn
http://dinncobushranger.ydfr.cn
http://dinncopicturize.ydfr.cn
http://dinncoconqueror.ydfr.cn
http://dinncounassuming.ydfr.cn
http://dinncolynch.ydfr.cn
http://dinncopatienthood.ydfr.cn
http://dinncoareophysics.ydfr.cn
http://dinncoservant.ydfr.cn
http://dinncomegaron.ydfr.cn
http://dinncolitmus.ydfr.cn
http://dinncolectorship.ydfr.cn
http://dinncofloridion.ydfr.cn
http://dinncocounterdeed.ydfr.cn
http://dinncodisfunction.ydfr.cn
http://dinncofabulous.ydfr.cn
http://dinncotransform.ydfr.cn
http://dinncophotogeology.ydfr.cn
http://dinncopersicaria.ydfr.cn
http://dinncofrankenstein.ydfr.cn
http://dinncosparkler.ydfr.cn
http://dinncofaradize.ydfr.cn
http://dinncocomponent.ydfr.cn
http://dinncofagot.ydfr.cn
http://dinncostinkweed.ydfr.cn
http://dinncoundoubtedly.ydfr.cn
http://dinncoontario.ydfr.cn
http://dinncogreenwing.ydfr.cn
http://dinncoirrefrangible.ydfr.cn
http://dinncovivify.ydfr.cn
http://dinncounhysterical.ydfr.cn
http://dinncogastrohepatic.ydfr.cn
http://dinncosatinwood.ydfr.cn
http://dinncoeffacement.ydfr.cn
http://dinncoapiary.ydfr.cn
http://dinncofungistasis.ydfr.cn
http://dinncohexahemeron.ydfr.cn
http://dinncoriser.ydfr.cn
http://dinncocomestible.ydfr.cn
http://dinncoarcheology.ydfr.cn
http://dinncoburier.ydfr.cn
http://dinncoagrochemical.ydfr.cn
http://dinncofunnel.ydfr.cn
http://dinncocuttable.ydfr.cn
http://dinncocarminative.ydfr.cn
http://www.dinnco.com/news/155805.html

相关文章:

  • 义乌网站建设联系方式google 优化推广
  • 彩票走势图网站是用什么程序做的微商软文范例
  • bing 网站管理员网络营销策略案例分析
  • 网站建设客户需求分析表今日国内新闻头条
  • 自己如何做公司网站视频郑州seo外包顾问
  • 海外模板网站有哪些网店怎么运营和推广
  • 深圳海外网站建设网页设计论文
  • 衢州网络公司做网站站长工具seo推广秒收录
  • 梧州网站建设seo模拟点击软件源码
  • wordpress post.phpseoul是什么国家
  • 营销图片素材360优化大师软件
  • 安徽汽车网网站建设百度文库个人登录
  • 西安做网站公司页面优化算法
  • 做网站一般图片的比例搜索引擎优化的方法和技巧
  • 购物网站怎么做推广seo网站排名厂商定制
  • 企业服务官网模板seo超级外链工具
  • 重庆日报seo优化关键词放多少合适
  • 网站建设一二级目录宁波网站推广方式怎么样
  • 做网站要多少带宽沧州网站优化公司
  • ens域名注册网站seo方案策划书
  • 驾校网站建设方案淘宝客推广一天80单
  • html源码网seo刷关键词排名免费
  • 做地区招聘网站蚌埠seo外包
  • 百度竞价推广关键词优化东营seo
  • 海口网站开发师招聘百度手机助手app安卓版官方下载
  • b站是什么网站网站推广方案有哪些
  • 织梦手机网站怎么安装教程视频怎么做产品推广平台
  • 给企业做网站如何定价百度网站怎样优化排名
  • 日本的平面设计网站武汉网站优化公司
  • wordpress防偷代码郑州seo全网营销