matrix() ফাংশন CSS-এ সমঘন ২D ট্রান্সফরমেশন ম্যাট্রিক্স সংজ্ঞায়িত করতে ব্যবহৃত হয়। এটি ৬টি প্যারামিটার নেয়: matrix(a, b, c, d, tx, ty)।
- a, d: স্কেলিং (X এবং Y)
- b, c: স্কিউইং (shearing)
- tx, ty: ট্রান্সলেশন (X এবং Y)
উদাহরণ ১
<!DOCTYPE html> <html> <head> <style> .demo { transform: matrix(2, 1, -1, 1, 190, 100); } .skew_img { transform-origin: top right; transform: skew(-0.10turn, 30deg); } </style> </head> <body> <h1>Learn</h1> <img class="demo" src="https://www.tutorialspoint.com/numpy/images/numpy-mini-logo.jpg" alt="Numpy"> <img class="skew_img" src="https://www.tutorialspoint.com/apache_spark/images/apache-spark-mini-logo.jpg" alt="Apache Spark"> </body> </html>
আউটপুট

উদাহরণ ২
<!DOCTYPE html> <html> <head> <style> .demo { transform: matrix(0.9, 0.8, -0.8, 0.8, 100, -30); } .skew_img { transform-origin: left; transform: skew(-0.10turn, 30deg); } </style> </head> <body> <h1>Learn</h1> <img class="demo" src="https://www.tutorialspoint.com/numpy/images/numpy-mini-logo.jpg" alt="Numpy"> <img class="skew_img" src="https://www.tutorialspoint.com/apache_spark/images/apache-spark-mini-logo.jpg" alt="Apache Spark"> </body> </html>
আউটপুট

ম্যাট্রিক্স সমীকরণ
নতুন কোয়ার্ডিনেট (x', y') = (ax + cy + tx, bx + dy + ty)
সুবিধা: একসাথে স্কেল, রোটেট, স্কিউ, ট্রান্সলেট করা যায়। কিন্তু পড়া/লেখা কঠিন। সাধারণত transform: translate() rotate() scale() skew() আলাদা করে লেখা ভালো।
3D সংস্করণ: matrix3d() — ১৬টি প্যারামিটার নেয় (4x4 ম্যাট্রিক্স)।