आप box shadow के बारे में कितना जानते हैं?
box shadow क्या है?
- box shadow drop shadow का एक प्रकार है, जो image filter का एक रूप है
- drop shadow एक filter है जो image के pixels को x और y axis के along खिसकाकर shadow effect देता है
- CSS में
filter property का उपयोग करके drop shadow लागू किया जा सकता है
div {
filter: drop-shadow(xOffset yOffset rgba(0, 0, 0, 0.5));
}
- CSS अतिरिक्त रूप से blur value को support करता है, जिसे drop shadow पर लागू किया जा सकता है
div {
filter: drop-shadow(xOffset yOffset blurSize rgba(0, 0, 0, 0.5));
}
box shadow
- box shadow box shape तक सीमित drop filter का एक प्रकार है
- box shadow performance के लिहाज़ से फ़ायदेमंद है
- CSS box shadow implementation गणितीय hack के ज़रिए rounded box को कम लागत में draw कर सकती है
- कई box shadows को layer करके अलग-अलग design बनाए जा सकते हैं
function randomizeAndColor(e) {
randomize(e);
const spread = Math.random() > 0.8 ? 2 : 0;
const x1 = Math.floor(3 - Math.random() * 6) / (1 + spread);
const y1 = Math.floor(3 - Math.random() * 6) / (1 + spread);
const y2 = 2 + Math.floor(Math.random() * 4);
const blur2 = 8 + Math.floor(Math.random() * 12);
e.style.boxShadow = `${x1}px ${y1}px 0px ${spread}px ${getRandomPastelColor()}, 0 ${y2}px ${blur2}px #0006`;
}
box shadow का गलत इस्तेमाल कैसे करें
- आम तौर पर designers rectangles को consistent margin, padding और typography के साथ place करते हैं
- box shadow का उपयोग करके अलग-अलग तरह के artistic effects बनाए जा सकते हैं
- box shadow का उपयोग करके animation effects दिए जा सकते हैं
const tick = (timestamp: number) => {
gameState.frame++;
gameState.deltaTime = Math.min((timestamp - gameState.prevFrameStartTime) / 1000, 0.1);
gameState.prevFrameStartTime = timestamp;
update(gameState);
render(gameState);
winContext._gameFrame = window.requestAnimationFrame(tick);
};
box shadow का बहुत ही गलत इस्तेमाल कैसे करें
- box shadow का उपयोग करके 3D effects बनाए जा सकते हैं
- उछलती हुई गेंद का animation बनाया जा सकता है
- box shadow का उपयोग करके dot cloud draw किया जा सकता है
const pixels = await getImagePixels("/images/starry_night_full.jpg", width);
const dx = window.innerWidth / pixels[0].length;
const dy = window.innerHeight / pixels.length;
for (let y = 0; y < pixels.length; y++) {
for (let x = 0; x < pixels[0].length; x++) {
const px = x * dx + dx / 2, py = y * dy + dy / 2, pz = 60 + Math.random() * 3;
state.particles.push({ size: pSize, x: px, y: py, z: pz, ox: px, oy: py, oz: pz, dx: Math.random() * 3, dy: Math.random() * 3, dz: Math.random() * 3, color: pixels[y][x] });
}
}
box shadow से ray tracing
- ray tracing image generation का एक सटीक लेकिन धीमा तरीका है
- box shadow का उपयोग करके ray tracing implement की जा सकती है
- web workers का उपयोग करके multi-threading implement की जा सकती है
const gameState = {
frame: 0,
prevFrameStartTime: 0,
deltaTime: 0,
renderContainerSize: 32,
cam: new PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100),
spheres: [
{ position: new Vector3(0, 1.3, 0), radius: 1.3, material: CreateMat({ color: new Color(1, 0.2, 0.3) }) },
{ position: new Vector3(-3, 1.3, 0), radius: 1.3, material: CreateMat({ color: new Color(0.9, 0.9, 0.9), smoothness: 0.9 }) },
{ position: new Vector3(0, 10.8, 0), radius: 3.6, material: CreateMat({ color: new Color(0, 0, 0), emissive: new Color(1, 1, 1), emissiveStrength: 8 }) }
]
};
# GN⁺ का सार
- box shadow drop shadow का एक प्रकार है, जो images में depth जोड़ने में उपयोगी है
- CSS का उपयोग करके अलग-अलग box shadow effects बनाए जा सकते हैं, जिनसे creative design तैयार किए जा सकते हैं
- box shadow का उपयोग करके 3D effects और animations implement किए जा सकते हैं
- box shadow से ray tracing implement करना अक्षम है, लेकिन संभव है
- यह लेख box shadow के creative और non-standard उपयोगों की पड़ताल करता है और इसके ज़रिए design की नई संभावनाएँ दिखाता है
अभी कोई टिप्पणी नहीं है.