const rotate = document.querySelector("#rotate");
const container = document.querySelector(".container");
container.style.transform = `rotate(${45}deg)`;
rotate.addEventListener('input', (e) => {
const degree = +e.target.value;
const scaleStep = degree*0.001;
const scale = degree === 0 && 1 || degree === 360 && 1 || scaleStep > 1 && 1 || scaleStep < 0.75 && 0.75 || scaleStep;
container.style.transform = `scale(${scale}, ${scale}) rotate(${degree}deg)`;
}); function Block1() {
let a, b, c
/* another code */
}(function() { /* my code */ })()Вопрос: как это работает?
function Button(props: IButtonProps) {
const scaleX = useSharedValue(1);
const scaleY = useSharedValue(1);
const scaleFontSize = useSharedValue(1);
const [isPressed, setIsPressed] = useState(false);
useEffect(() => {
scaleFontSize.value = animationWithRepeat(1.07070707070707072);
scaleX.value = animationWithRepeat(1.1071428571428572);
scaleY.value = animationWithRepeat(1.1111111111111111);
}, []);
return (
<AnimatedPressable style={[
styles.defaultButton,
!isPressed ? styles.notPressedButton : styles.pressedButton,
{ transform: [ {scaleX}, {scaleY} ] },
props.styles
]}>
<AnimatedText style={[
styles.defaultText,
!isPressed ? styles.notPressedText : styles.pressedText,
]}>Принять</AnimatedText>
</AnimatedPressable>
)
} const menu = document.querySelector('.burger-menu');
const menuList = document.querySelector('.menu__list');
const activateMenu = () => (menuList.classList.toggle('active-menu'), menu.classList.toggle('active'));
menu.addEventListener('click', activateMenu, true); const array = [1, 255, 639, 9, 7, 8, 5, 4, 2];
const randomIndex = arr => Math.round(Math.random() * (arr.length-1));
const randomEl = arr => {
let index = randomIndex(arr), prev = arr[index];
return () => {
do {
index = randomIndex(arr);
}
while(prev === arr[index]);
prev = arr[index];
return arr[index];
}
}
const getRandomEl = randomEl(array);
for(let i = 0; i < 10; i++) {
console.log(getRandomEl());
}