19. Mouse hover ray effect

Effect (the source code network disk address is at the end)

Pay attention to the public account "Moving the World" to see more video tutorials!

source code

index.html

<!DOCTYPE html>
<html lang="en" >
<head>
  <meta charset="UTF-8">
  <title>鼠标悬停射线特效</title>
  <link rel="stylesheet" href="./style.css">

</head>
<body>
<img src='./im1.jpg' alt='cats'>

  
</body>
</html>

css

@property --k {
  syntax: "<number>";
  initial-value: 0;
  inherits: false;
}
body {
  display: grid;
  margin: 0;
  height: 100vh;
}

img {
  --k: 0;
  --j: calc(1 - var(--k));
  --list: transparent calc(50% - 4vmin), red 0 calc(50% + 4vmin

Guess you like

Origin blog.csdn.net/qq449245884/article/details/122749227