need that block to be attached strictly from the right side-end of gradient expansion,…
- User
need that block to be attached strictly from the right side-end of gradient expansion, so it can translate from left-initial to the most-right side in animation duration: ```
code.textarea { width: 100%; height: auto; font-family: 'Courier New', monospace; font-size: 18px; color: cyan; background-color: #010101; border: none; overflow: auto; white-space: pre-wrap; word-wrap: break-word; line-height: 1.4; } .highlight-line { position: relative; display: inline-block; } span { color: white; width: 100%; } .highlight-line:before { content: ''; color: white; position: absolute; left: -18px; width: 0; height: 100%; background-image: linear-gradient(to right, royalblue, cyan); pointer-events: none; animation: shot .3s linear forwards, blink .05s .1s infinite; }@keyframes shot { 100% { width: 100%; opacity: 0; } } @keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
code - Assistant
To make the block strictly attached from the right side-end of the gradient expansion, you can modify the CSS for the
.highlight-line:beforeclass. Replace theleft: -18px;property withright: 0;. This will position the block from the right-most side of the gradient expansion.Here's the updated CSS:
css.highlight-line:before { content: ''; color: white; position: absolute; right: 0; width: 0; height: 100%; background-image: linear-gradient(to right, royalblue, cyan); pointer-events: none; animation: shot .3s linear forwards, blink .05s .1s infinite; }By making this change, the block will now translate from left-initial to the most-right side in the animation duration.