|
| 1 | +<template> |
| 2 | + <div class="future-star__container" :class="['future-star--kind-' + kind]"> |
| 3 | + <div class="future-star"></div> |
| 4 | + </div> |
| 5 | +</template> |
| 6 | + |
| 7 | +<script setup> |
| 8 | +const { kind } = defineProps({ kind: { type: String, required: true } }); |
| 9 | +const starSize = 10; |
| 10 | +const lengthRate = 32; /* 正確には22程度だが動いていると短く見えるので長めに設定する */ |
| 11 | +const starWidth = starSize * (lengthRate + 0.5); |
| 12 | +const starPath = `path("M 0 ${starSize / 2} l ${starSize * lengthRate} -${starSize / 2} a 1 1 0 0 1 0 ${starSize} Z")`; |
| 13 | +</script> |
| 14 | + |
| 15 | +<style scoped> |
| 16 | +:global(.standards-home .clip) { |
| 17 | + /* タイトルをアンカーにする */ |
| 18 | + anchor-name: --future-title; |
| 19 | +} |
| 20 | +
|
| 21 | +.future-star__container { |
| 22 | + position: fixed; |
| 23 | + width: calc(100vw + v-bind(starWidth * 2 + "px")); |
| 24 | + min-width: calc(800px + v-bind(starWidth * 2 + "px")); |
| 25 | + bottom: calc(100vh - 160px); /* fallback */ |
| 26 | + z-index: -1; /* fallback の場合にコンテンツの後ろに配置したいので-1 */ |
| 27 | + position-anchor: --future-title; |
| 28 | + bottom: calc(anchor(top) - 10px); |
| 29 | + left: v-bind(-starWidth + "px"); |
| 30 | + filter: blur(3px); |
| 31 | + transform-origin: left 50%; |
| 32 | + opacity: 0.1; |
| 33 | +} |
| 34 | +.dark .future-star__container { |
| 35 | + opacity: 0.2; |
| 36 | +} |
| 37 | +.future-star--kind-1 { |
| 38 | + transform: rotate(-6deg); |
| 39 | +} |
| 40 | +.future-star--kind-2 { |
| 41 | + transform: rotate(-4deg); |
| 42 | +} |
| 43 | +.future-star { |
| 44 | + position: absolute; |
| 45 | + background-color: #da0058; |
| 46 | + height: v-bind(starSize + "px"); |
| 47 | + width: v-bind(starWidth + "px"); |
| 48 | + clip-path: v-bind(starPath); |
| 49 | +
|
| 50 | + animation-composition: add; |
| 51 | + animation-name: slide-to-right; |
| 52 | + animation-duration: 10s; |
| 53 | + animation-iteration-count: infinite; |
| 54 | + animation-timing-function: linear; |
| 55 | + animation-timeline:; |
| 56 | +} |
| 57 | +.future-star--kind-2 .future-star { |
| 58 | + animation-delay: 250ms; |
| 59 | +} |
| 60 | +@keyframes slide-to-right { |
| 61 | + 0% { |
| 62 | + left: 0; |
| 63 | + } |
| 64 | + 50% { |
| 65 | + left: 100%; |
| 66 | + } |
| 67 | + 100% { |
| 68 | + left: 100%; |
| 69 | + } |
| 70 | +} |
| 71 | +</style> |
0 commit comments