-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix the context-element change requestAnimationFrame
Fix the context element change request anmiation frame to timeout
- Loading branch information
1 parent
1e27a85
commit a4e33fe
Showing
9 changed files
with
195 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
body{ | ||
margin: 0px; | ||
padding: 0px; | ||
} | ||
.container{ | ||
display: flex; | ||
width: 100vw; | ||
height : 100vh; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
.box{ | ||
background-color: rgba(0,0,0,0); | ||
display: inline-block; | ||
border: 10rem solid rgba(0,0,0,0); | ||
border-bottom:77rem solid rgba(255,0,0,1); | ||
transform: rotate(0deg); | ||
transform-origin: top; | ||
} | ||
.box-container{ | ||
margin-top: -10rem; | ||
} | ||
.dot{ | ||
width: 2px; | ||
height: 2px; | ||
display: flex; | ||
justify-content: center; | ||
transform: rotate(10deg); | ||
position: absolute; | ||
} | ||
.context-array{ | ||
width: 40rem; | ||
height: 40rem; | ||
border-radius: 40rem; | ||
overflow: hidden; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
position: absolute; | ||
|
||
} | ||
.palates-container{ | ||
position: relative; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Color Palete</title> | ||
<link rel="stylesheet" href="index.css"> | ||
<script src="../../src/index.ts"></script> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<context-element id="palate"> | ||
<context-array data.watch="palateOne" data.key="id" class="palates-container"> | ||
<context-array data.watch="palateTwo" data.key="id" class="context-array" style.watch="scale"> | ||
<div class="dot" style.watch="style"> | ||
<div class="box-container"> | ||
<div class="box" style.watch="colorStyle" onmouseenter.action="SET_COLOR"></div> | ||
</div> | ||
</div> | ||
</context-array> | ||
</context-array> | ||
</context-element> | ||
</div> | ||
<script src="index.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
document.body.onload = () => { | ||
const palateElement = document.getElementById('palate'); | ||
const layer = 16; | ||
const maximumHueColor = 360; | ||
const palate = 24; | ||
const degree = Math.round(maximumHueColor / palate ); | ||
const saturationRange = 50; | ||
const lightRange = 60; | ||
palateElement.data = { | ||
palateOne : Array.from({length:layer}).map((_,id) => { | ||
const layerIndex = id; | ||
const saturation = Math.round((saturationRange / layer) * (layer - (layerIndex + 0))); | ||
const scale = `transform : scale(${ (1/layer) * (layer - layerIndex) })`; | ||
const light = Math.round((lightRange / layer) * (layer - layerIndex)); | ||
return { | ||
id, | ||
scale, | ||
palateTwo : Array.from({length:(palate)}).map((_,id) => { | ||
const colorStyle = `border-bottom-color: hsl(${degree * id},${(100 - saturationRange)+saturation}%,${light + 20 }%) !important`; | ||
return { | ||
id, | ||
style:`transform : rotate(${(degree) * id}deg)`, | ||
colorStyle | ||
} | ||
}) | ||
} | ||
}) | ||
} | ||
|
||
palateElement.reducer = (context,action) => { | ||
debugger; | ||
console.log(action); | ||
return {...context}; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.