div+css实现拖动滑块旋转花朵动画效果代码
代码语言:html
所属分类:布局界面
代码描述:div+css实现拖动滑块旋转花朵动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> html { box-sizing: border-box; } *, *:before, *:after { box-sizing: inherit; position: relative; background-repeat: no-repeat; } body { display: grid; place-items: center; height: 1000vh; background: olive; } input { position: fixed; z-index: 2; top: 0; } .flower { --leaf-width: 30vmin; --leaf-height: 30vmin; --leaf-index: 0; --leaf-total: 10; --leaf-color-top: white; --leaf-color-bot: #ccc; --center-size: 15vmin; position: fixed; top: 50vh; width: 0; height: 0; display: grid; filter: blur(calc(var(--blur, 0) * 20px)); transition: filter 1s ease-in-out, scale 1s ease-in-out; rotate: calc(var(--blur) * 1turn); filter: drop-shadow(0 0 4rem rgba(0, 0, 0, 0.5)); } .flower > * { grid-row: 1; grid-column: 1; } .flower::before { content: ""; width: var(--center-size); height: var(--center-size); background: orange; position: absolute; top: calc(50% - var(--center-size) / 2); left: calc(50% - var(--center-size) / 2); z-index: 2; border-radius: 1000vw; box-shadow: 0 0 2rem rgba(0, 0, 0, 0.5); background-image: radial-gradient(circle at 80% 20%, gold, 40%, orangered); } .flower:hover { scale: 1.1; filter: drop-shadow(0 4rem 2rem rgba(0, 0, 0, 0.5)); } .leaf:hover { scale: 1.1; } .leaf { --color-back: var(--leaf-color-bot); cursor: pointer; transition: 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); width: var(--leaf-width); height: var(--leaf-height); background: var(--color-back); border-radius: 76% 24% 100% 0%/100% 24% 76% 0%; transform-origin: bottom left; rotate: calc(var(--leaf-index) / var(--leaf-total) * 1turn); translate: 0 -100%; display: flex; align-items: center; justify-content: center; color: transparent; box-shadow: 0 0 2rem rgba(0.........完整代码请登录后点击上方下载按钮下载查看
网友评论0