安卓木马demo_小demo 旋转木马

该博客介绍了一种使用CSS3实现3D翻转导航的方法,通过transform-style: preserve-3d开启三维环境,并应用关键帧动画实现平滑无限循环的翻转效果。当鼠标悬停时,动画暂停,展示了细节交互设计。
摘要由CSDN通过智能技术生成
翻转导航

}/*最外面的盒子*/section {

position: relative;

width: 300px;

height: 200px;

background: url(img/pig.jpg);

margin: 200px auto;

transform-style: preserve-3d;/*给子元素开启三维环境 重点代码*/animation: rotate 10s linear infinite;/*调用动画:匀速执行 重复执行*/}/*鼠标滑过动画暂停*/section:hover {

animation-play-state: paused;

}

section div {

position: absolute;

left:0;

top:0;

width:100%;

height:100%;

background: url(img/dog.jpg);

}

section div:nth-child(1) {

background: url(img/ym.jpg);/*第一个做正面 不需要旋转*/ /*先旋转 再移动*/transform: rotateY(0) translateZ(300px);

}

section div:nth-child(2) {/*先旋转 再移动*/transform: rotateY(60deg) translateZ(300px);

}

section div:nth-child(3) {/*先旋转 再移动*/transform: rotateY(120deg) translateZ(300px);

}

section div:nth-child(4) {/*先旋转 再移动*/transform: rotateY(180deg) translateZ(300px);

}

section div:nth-child(5) {/*先旋转 再移动*/transform: rotateY(240deg) translateZ(300px);

}

section div:nth-child(6) {/*先旋转 再移动*/transform: rotateY(300deg) translateZ(300px);

}/*定义动画*/@keyframes rotate {from{

transform: rotateY(0deg);

}

to {

transform: rotateY(360deg);

}

}

1
2
3
4
5
6

demo的图片随意替换

旋转木马布局效果     gradle    compile 'com.dalong:carrousellayout:1.0.0'or Maven    <dependency>       <groupId>com.dalong</groupId>       <artifactId>carrousellayout</artifactId>       <version>1.0.0</version>       <type>pom</type>     </dependency>xml:     <com.dalong.carrousellayout.CarrouselLayout            android:id="@ id/carrousel"            app:rotateDirection="anticlockwise"            app:r="200dp"            app:rotationTime="3000"            android:gravity="center"            android:layout_marginBottom="180dp"            android:layout_width="match_parent"            android:layout_height="match_parent">           <ImageView               android:src="@mipmap/image1"               android:layout_width="wrap_content"               android:layout_height="wrap_content" />           <ImageView               android:src="@mipmap/image2"               android:layout_width="wrap_content"               android:layout_height="wrap_content" />               ...        </com.dalong.carrousellayout.CarrouselLayout>java:    CarrouselLayout carrousel= (CarrouselLayout) findViewById(R.id.carrousel);     carrousel.setR(width/3)//设置R的大小              .setAutoRotation(false)//是否自动切换              .setAutoRotationTime(1500);//自动切换的时间  单位毫秒
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值