SlideShare une entreprise Scribd logo
1  sur  17
Télécharger pour lire hors ligne
2D in HTML5
‫الرحیم‬ ‫الرحمن‬ ‫الله‬ ‫بسم‬
Coordinate
2D in web
● SVG
– Vector base
– Xml
● Canvas
– Raster base
– Only by code
SVG
<svg width="100" height="100">
<!-- other tag -->
browser dose n’t support SVG
</svg>
SVG
● Basic
– Line
– Rectangle(rect)
– Circle
– text
– ellipse
– polygon
– Polyline
– a
SVG
<rect x="2" y="2" width="50" height="50" style="fill:red;stroke-width:3;stroke:black" />
<line x1="55" y1="0" x2="100" y2="50" style="stroke:green;stroke-width:2" />
<circle cx="125" cy="25" r="23" stroke="black" stroke-width="3" fill="rgb(0,0,150)" />
<ellipse cx="175" cy="25" rx="20" ry="12" style="fill:yellow;stroke:purple;stroke-width:2" />
<polygon points="200,10 240,30 210,40" style="fill:lime;stroke:purple;stroke-width:1" />
<polyline points="250,10 290,30 250,40" style="fill:hsl(170,50%,50%);stroke:purple;stroke-width:1" />
<text x="0" y="15" fill="rgba(25,125,253,0.5)">I love SVG!</text>
SVG path
The following commands are available for path data:
M = moveto x1 y1
L = lineto x1 y1
H = horizontal lineto x
V = vertical lineto y
C = curveto a1 a2 b1 b2 x1 y1
S = smooth curveto b1 b2 x y
Q = quadratic Bézier curve a1 a2 ,x1 y1
T = smooth quadratic Bézier curveto x1,y1
A = elliptical Arc
Z = closepath
Lowercase command names mean use relative
<path d="M 10 10 h 75 v 50 l 50 0 c 25 -25, 30 30 ,50 50 s 0 -50 ,50 50 l -150 50 z" fill="red" />
SVG
● Advance
– G
– Filter
– Linear Gradient,Radial Gradient
– …
Canvas
<canvas id="myCanvas" width="200" height="100">
browser dose n’t support Canvas
</canvas>
<script>
var canvas = document.getElementById("myCanvas");
var context = canvas.getContext("2d");
</script>
<script>
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.clearRect(0, 0, canvas.width, canvas.height);
context.beginPath();
context.moveTo(100, 20);
// line 1
context.lineTo(200, 160);
// quadratic curve
context.quadraticCurveTo(230, 200, 250, 120);
// bezier curve
context.bezierCurveTo(290, -40, 300, 200, 400, 150);
// line 2
context.lineTo(500, 90);
// context.arc(x, y, radius, startAngle, endAngle, counterClockwise);
//context.rect(188, 50, 200, 100);
//context.drawImage(imageObj, sourceX, sourceY, sourceWidth, sourceHeight, destX, destY, destWidth, destHeight);
context.lineWidth = 5;
context.strokeStyle = 'blue';
context.stroke();
</script>
Stroke,fill
● Fill
context.fillStyle = '#8ED6FF'; // color ,Gradient,pattern
context.fill();
● stroke
context.lineWidth = 5;
context.strokeStyle = 'blue'; // ? :)
context.stroke();
● Linear Gradient
– var grd=context.createLinearGradient(x1,y1,x2,y2);
– grd.addColorStop(0-1,color);
● Radial Gradient
– var grd=context.createRadialGradient(x,y,r,x1,y1,r1);
– grd.addColorStop(0-1,color);
● Pattern
– var pattern = context.createPattern(imageObj,mode); //
repeat, repeat-x, repeat-y,no-repeat.
Canvas Translate
● context.translate(dx,dy);
● context.scale(dx, dy);
● context.rotate(d);
● context.transform(a, b, c, d, e, f);
● context.save(); / context.restore();
other
● Shadow
– context.shadowColor = '#999';
– context.shadowBlur = 20;
– context.shadowOffsetX = 15;
– context.shadowOffsetY = 15;
● context.globalAlpha = 0.5;
● context.clip();
?
● Analyze sample game wite by js

Contenu connexe

Similaire à HTML 5 گرافیک دو بعدی در

Algorithms in CSS v3.1.0 | CSS Day 2019
Algorithms in CSS v3.1.0 | CSS Day 2019Algorithms in CSS v3.1.0 | CSS Day 2019
Algorithms in CSS v3.1.0 | CSS Day 2019Lara Schenck
 
SVG vs Canvas - Showdown of the Painters
SVG vs Canvas - Showdown of the PaintersSVG vs Canvas - Showdown of the Painters
SVG vs Canvas - Showdown of the PaintersPhil Reither
 
SVG, CSS3, and D3 for Beginners
SVG, CSS3, and D3 for BeginnersSVG, CSS3, and D3 for Beginners
SVG, CSS3, and D3 for BeginnersOswald Campesato
 
Лаб.р №1 "Фабрика Blockly"
Лаб.р №1 "Фабрика Blockly"Лаб.р №1 "Фабрика Blockly"
Лаб.р №1 "Фабрика Blockly"OlesiaJL
 
STC Summit 2015 Hypergraphics for visual-first help
STC Summit 2015 Hypergraphics for visual-first helpSTC Summit 2015 Hypergraphics for visual-first help
STC Summit 2015 Hypergraphics for visual-first helpDave Gardiner
 
Professional reports with SVG
Professional reports with SVGProfessional reports with SVG
Professional reports with SVGSpeedPartner GmbH
 
I Can't Believe It's Not Flash
I Can't Believe It's Not FlashI Can't Believe It's Not Flash
I Can't Believe It's Not FlashThomas Fuchs
 
HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event
HTML5 and CSS3 – exploring mobile possibilities - Dynabyte eventHTML5 and CSS3 – exploring mobile possibilities - Dynabyte event
HTML5 and CSS3 – exploring mobile possibilities - Dynabyte eventRobert Nyman
 
CSS3 Takes on the World
CSS3 Takes on the WorldCSS3 Takes on the World
CSS3 Takes on the WorldJonathan Snook
 
CANVAS, SVG, WebGL, CSS3, WebEvent
CANVAS, SVG, WebGL, CSS3, WebEventCANVAS, SVG, WebGL, CSS3, WebEvent
CANVAS, SVG, WebGL, CSS3, WebEvent민태 김
 
Advanced html5 diving into the canvas tag
Advanced html5 diving into the canvas tagAdvanced html5 diving into the canvas tag
Advanced html5 diving into the canvas tagDavid Voyles
 
IE9에서 HTML5 개발하기
IE9에서 HTML5 개발하기IE9에서 HTML5 개발하기
IE9에서 HTML5 개발하기Reagan Hwang
 
SVG (Devoxx 2011, 2011-NOV-14)
SVG (Devoxx 2011, 2011-NOV-14)SVG (Devoxx 2011, 2011-NOV-14)
SVG (Devoxx 2011, 2011-NOV-14)Filip Van Laenen
 
A HTML5 platform demókon keresztül
A HTML5 platform demókon keresztülA HTML5 platform demókon keresztül
A HTML5 platform demókon keresztülZoltán Dávid
 
Creating dynamic SVG elements in JavaScript
Creating dynamic SVG elements in JavaScriptCreating dynamic SVG elements in JavaScript
Creating dynamic SVG elements in JavaScriptJoseph Khan
 
HTML5 and CSS3 – exploring mobile possibilities - Frontend Conference Zürich
HTML5 and CSS3 – exploring mobile possibilities - Frontend Conference ZürichHTML5 and CSS3 – exploring mobile possibilities - Frontend Conference Zürich
HTML5 and CSS3 – exploring mobile possibilities - Frontend Conference ZürichRobert Nyman
 
CSS3 TTA (Transform Transition Animation)
CSS3 TTA (Transform Transition Animation)CSS3 TTA (Transform Transition Animation)
CSS3 TTA (Transform Transition Animation)창석 한
 

Similaire à HTML 5 گرافیک دو بعدی در (20)

Html5 SVG
Html5 SVGHtml5 SVG
Html5 SVG
 
Algorithms in CSS v3.1.0 | CSS Day 2019
Algorithms in CSS v3.1.0 | CSS Day 2019Algorithms in CSS v3.1.0 | CSS Day 2019
Algorithms in CSS v3.1.0 | CSS Day 2019
 
Raphaël
RaphaëlRaphaël
Raphaël
 
SVG vs Canvas - Showdown of the Painters
SVG vs Canvas - Showdown of the PaintersSVG vs Canvas - Showdown of the Painters
SVG vs Canvas - Showdown of the Painters
 
SVG, CSS3, and D3 for Beginners
SVG, CSS3, and D3 for BeginnersSVG, CSS3, and D3 for Beginners
SVG, CSS3, and D3 for Beginners
 
Css6 svg
Css6 svgCss6 svg
Css6 svg
 
Лаб.р №1 "Фабрика Blockly"
Лаб.р №1 "Фабрика Blockly"Лаб.р №1 "Фабрика Blockly"
Лаб.р №1 "Фабрика Blockly"
 
STC Summit 2015 Hypergraphics for visual-first help
STC Summit 2015 Hypergraphics for visual-first helpSTC Summit 2015 Hypergraphics for visual-first help
STC Summit 2015 Hypergraphics for visual-first help
 
Professional reports with SVG
Professional reports with SVGProfessional reports with SVG
Professional reports with SVG
 
I Can't Believe It's Not Flash
I Can't Believe It's Not FlashI Can't Believe It's Not Flash
I Can't Believe It's Not Flash
 
HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event
HTML5 and CSS3 – exploring mobile possibilities - Dynabyte eventHTML5 and CSS3 – exploring mobile possibilities - Dynabyte event
HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event
 
CSS3 Takes on the World
CSS3 Takes on the WorldCSS3 Takes on the World
CSS3 Takes on the World
 
CANVAS, SVG, WebGL, CSS3, WebEvent
CANVAS, SVG, WebGL, CSS3, WebEventCANVAS, SVG, WebGL, CSS3, WebEvent
CANVAS, SVG, WebGL, CSS3, WebEvent
 
Advanced html5 diving into the canvas tag
Advanced html5 diving into the canvas tagAdvanced html5 diving into the canvas tag
Advanced html5 diving into the canvas tag
 
IE9에서 HTML5 개발하기
IE9에서 HTML5 개발하기IE9에서 HTML5 개발하기
IE9에서 HTML5 개발하기
 
SVG (Devoxx 2011, 2011-NOV-14)
SVG (Devoxx 2011, 2011-NOV-14)SVG (Devoxx 2011, 2011-NOV-14)
SVG (Devoxx 2011, 2011-NOV-14)
 
A HTML5 platform demókon keresztül
A HTML5 platform demókon keresztülA HTML5 platform demókon keresztül
A HTML5 platform demókon keresztül
 
Creating dynamic SVG elements in JavaScript
Creating dynamic SVG elements in JavaScriptCreating dynamic SVG elements in JavaScript
Creating dynamic SVG elements in JavaScript
 
HTML5 and CSS3 – exploring mobile possibilities - Frontend Conference Zürich
HTML5 and CSS3 – exploring mobile possibilities - Frontend Conference ZürichHTML5 and CSS3 – exploring mobile possibilities - Frontend Conference Zürich
HTML5 and CSS3 – exploring mobile possibilities - Frontend Conference Zürich
 
CSS3 TTA (Transform Transition Animation)
CSS3 TTA (Transform Transition Animation)CSS3 TTA (Transform Transition Animation)
CSS3 TTA (Transform Transition Animation)
 

Plus de Shiraz LUG

منطق فازی
منطق فازیمنطق فازی
منطق فازیShiraz LUG
 
بینایی ماشین
بینایی ماشینبینایی ماشین
بینایی ماشینShiraz LUG
 
رایانش ابری
رایانش ابریرایانش ابری
رایانش ابریShiraz LUG
 
Ubuntu workshop
Ubuntu workshopUbuntu workshop
Ubuntu workshopShiraz LUG
 
Python workshop
Python workshopPython workshop
Python workshopShiraz LUG
 
پردازش زبان طبیعی
پردازش زبان طبیعیپردازش زبان طبیعی
پردازش زبان طبیعیShiraz LUG
 
امنیت در نرم افزارهای وب
امنیت در نرم افزارهای وبامنیت در نرم افزارهای وب
امنیت در نرم افزارهای وبShiraz LUG
 
gnu و fsf پروژه های پیشنهادی
gnu و fsf پروژه های پیشنهادی gnu و fsf پروژه های پیشنهادی
gnu و fsf پروژه های پیشنهادی Shiraz LUG
 
Embedded Linux
Embedded LinuxEmbedded Linux
Embedded LinuxShiraz LUG
 
(رمزنگاری (گذشته، حال، آینده
(رمزنگاری (گذشته، حال، آینده(رمزنگاری (گذشته، حال، آینده
(رمزنگاری (گذشته، حال، آیندهShiraz LUG
 
(اصول پایه ویدئو و صوت دیجیتال (قسمت دوم
(اصول پایه ویدئو و صوت دیجیتال (قسمت دوم(اصول پایه ویدئو و صوت دیجیتال (قسمت دوم
(اصول پایه ویدئو و صوت دیجیتال (قسمت دومShiraz LUG
 
(اصول پایه ویدئو و صوت دیجیتال (قسمت اول
(اصول پایه ویدئو و صوت دیجیتال (قسمت اول(اصول پایه ویدئو و صوت دیجیتال (قسمت اول
(اصول پایه ویدئو و صوت دیجیتال (قسمت اولShiraz LUG
 
برنامه نویسی مستقل از پلتفرم با استفاده از .NET Core و C#
برنامه نویسی مستقل از پلتفرم با استفاده از .NET Core و C#برنامه نویسی مستقل از پلتفرم با استفاده از .NET Core و C#
برنامه نویسی مستقل از پلتفرم با استفاده از .NET Core و C#Shiraz LUG
 
فرصت های برنامه نویسی با بلاک چین
فرصت های برنامه نویسی با بلاک چینفرصت های برنامه نویسی با بلاک چین
فرصت های برنامه نویسی با بلاک چینShiraz LUG
 
توانمندسازی سازمان های مردم نهاد
توانمندسازی سازمان های مردم نهادتوانمندسازی سازمان های مردم نهاد
توانمندسازی سازمان های مردم نهادShiraz LUG
 
کنترل ورژن گیت
کنترل ورژن گیتکنترل ورژن گیت
کنترل ورژن گیتShiraz LUG
 
Lua زبان برنامه نویسی
Lua زبان برنامه نویسی Lua زبان برنامه نویسی
Lua زبان برنامه نویسی Shiraz LUG
 
R یادگیری ماشین با استفاده از زبان برنامه نویسی
R یادگیری ماشین با استفاده از زبان برنامه نویسیR یادگیری ماشین با استفاده از زبان برنامه نویسی
R یادگیری ماشین با استفاده از زبان برنامه نویسیShiraz LUG
 
برای طراحان گرافیک inkscape
 برای طراحان گرافیک inkscape برای طراحان گرافیک inkscape
برای طراحان گرافیک inkscapeShiraz LUG
 
SMO و SEO آشنایی با
SMO و SEO آشنایی با SMO و SEO آشنایی با
SMO و SEO آشنایی با Shiraz LUG
 

Plus de Shiraz LUG (20)

منطق فازی
منطق فازیمنطق فازی
منطق فازی
 
بینایی ماشین
بینایی ماشینبینایی ماشین
بینایی ماشین
 
رایانش ابری
رایانش ابریرایانش ابری
رایانش ابری
 
Ubuntu workshop
Ubuntu workshopUbuntu workshop
Ubuntu workshop
 
Python workshop
Python workshopPython workshop
Python workshop
 
پردازش زبان طبیعی
پردازش زبان طبیعیپردازش زبان طبیعی
پردازش زبان طبیعی
 
امنیت در نرم افزارهای وب
امنیت در نرم افزارهای وبامنیت در نرم افزارهای وب
امنیت در نرم افزارهای وب
 
gnu و fsf پروژه های پیشنهادی
gnu و fsf پروژه های پیشنهادی gnu و fsf پروژه های پیشنهادی
gnu و fsf پروژه های پیشنهادی
 
Embedded Linux
Embedded LinuxEmbedded Linux
Embedded Linux
 
(رمزنگاری (گذشته، حال، آینده
(رمزنگاری (گذشته، حال، آینده(رمزنگاری (گذشته، حال، آینده
(رمزنگاری (گذشته، حال، آینده
 
(اصول پایه ویدئو و صوت دیجیتال (قسمت دوم
(اصول پایه ویدئو و صوت دیجیتال (قسمت دوم(اصول پایه ویدئو و صوت دیجیتال (قسمت دوم
(اصول پایه ویدئو و صوت دیجیتال (قسمت دوم
 
(اصول پایه ویدئو و صوت دیجیتال (قسمت اول
(اصول پایه ویدئو و صوت دیجیتال (قسمت اول(اصول پایه ویدئو و صوت دیجیتال (قسمت اول
(اصول پایه ویدئو و صوت دیجیتال (قسمت اول
 
برنامه نویسی مستقل از پلتفرم با استفاده از .NET Core و C#
برنامه نویسی مستقل از پلتفرم با استفاده از .NET Core و C#برنامه نویسی مستقل از پلتفرم با استفاده از .NET Core و C#
برنامه نویسی مستقل از پلتفرم با استفاده از .NET Core و C#
 
فرصت های برنامه نویسی با بلاک چین
فرصت های برنامه نویسی با بلاک چینفرصت های برنامه نویسی با بلاک چین
فرصت های برنامه نویسی با بلاک چین
 
توانمندسازی سازمان های مردم نهاد
توانمندسازی سازمان های مردم نهادتوانمندسازی سازمان های مردم نهاد
توانمندسازی سازمان های مردم نهاد
 
کنترل ورژن گیت
کنترل ورژن گیتکنترل ورژن گیت
کنترل ورژن گیت
 
Lua زبان برنامه نویسی
Lua زبان برنامه نویسی Lua زبان برنامه نویسی
Lua زبان برنامه نویسی
 
R یادگیری ماشین با استفاده از زبان برنامه نویسی
R یادگیری ماشین با استفاده از زبان برنامه نویسیR یادگیری ماشین با استفاده از زبان برنامه نویسی
R یادگیری ماشین با استفاده از زبان برنامه نویسی
 
برای طراحان گرافیک inkscape
 برای طراحان گرافیک inkscape برای طراحان گرافیک inkscape
برای طراحان گرافیک inkscape
 
SMO و SEO آشنایی با
SMO و SEO آشنایی با SMO و SEO آشنایی با
SMO و SEO آشنایی با
 

Dernier

A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 

Dernier (20)

A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 

HTML 5 گرافیک دو بعدی در

  • 1.
  • 2. 2D in HTML5 ‫الرحیم‬ ‫الرحمن‬ ‫الله‬ ‫بسم‬
  • 4. 2D in web ● SVG – Vector base – Xml ● Canvas – Raster base – Only by code
  • 5. SVG <svg width="100" height="100"> <!-- other tag --> browser dose n’t support SVG </svg>
  • 6. SVG ● Basic – Line – Rectangle(rect) – Circle – text – ellipse – polygon – Polyline – a
  • 7. SVG <rect x="2" y="2" width="50" height="50" style="fill:red;stroke-width:3;stroke:black" /> <line x1="55" y1="0" x2="100" y2="50" style="stroke:green;stroke-width:2" /> <circle cx="125" cy="25" r="23" stroke="black" stroke-width="3" fill="rgb(0,0,150)" /> <ellipse cx="175" cy="25" rx="20" ry="12" style="fill:yellow;stroke:purple;stroke-width:2" /> <polygon points="200,10 240,30 210,40" style="fill:lime;stroke:purple;stroke-width:1" /> <polyline points="250,10 290,30 250,40" style="fill:hsl(170,50%,50%);stroke:purple;stroke-width:1" /> <text x="0" y="15" fill="rgba(25,125,253,0.5)">I love SVG!</text>
  • 8. SVG path The following commands are available for path data: M = moveto x1 y1 L = lineto x1 y1 H = horizontal lineto x V = vertical lineto y C = curveto a1 a2 b1 b2 x1 y1 S = smooth curveto b1 b2 x y Q = quadratic Bézier curve a1 a2 ,x1 y1 T = smooth quadratic Bézier curveto x1,y1 A = elliptical Arc Z = closepath Lowercase command names mean use relative <path d="M 10 10 h 75 v 50 l 50 0 c 25 -25, 30 30 ,50 50 s 0 -50 ,50 50 l -150 50 z" fill="red" />
  • 9. SVG ● Advance – G – Filter – Linear Gradient,Radial Gradient – …
  • 10. Canvas <canvas id="myCanvas" width="200" height="100"> browser dose n’t support Canvas </canvas> <script> var canvas = document.getElementById("myCanvas"); var context = canvas.getContext("2d"); </script>
  • 11. <script> var canvas = document.getElementById('myCanvas'); var context = canvas.getContext('2d'); context.clearRect(0, 0, canvas.width, canvas.height); context.beginPath(); context.moveTo(100, 20); // line 1 context.lineTo(200, 160); // quadratic curve context.quadraticCurveTo(230, 200, 250, 120); // bezier curve context.bezierCurveTo(290, -40, 300, 200, 400, 150); // line 2 context.lineTo(500, 90); // context.arc(x, y, radius, startAngle, endAngle, counterClockwise); //context.rect(188, 50, 200, 100); //context.drawImage(imageObj, sourceX, sourceY, sourceWidth, sourceHeight, destX, destY, destWidth, destHeight); context.lineWidth = 5; context.strokeStyle = 'blue'; context.stroke(); </script>
  • 12. Stroke,fill ● Fill context.fillStyle = '#8ED6FF'; // color ,Gradient,pattern context.fill(); ● stroke context.lineWidth = 5; context.strokeStyle = 'blue'; // ? :) context.stroke();
  • 13. ● Linear Gradient – var grd=context.createLinearGradient(x1,y1,x2,y2); – grd.addColorStop(0-1,color); ● Radial Gradient – var grd=context.createRadialGradient(x,y,r,x1,y1,r1); – grd.addColorStop(0-1,color); ● Pattern – var pattern = context.createPattern(imageObj,mode); // repeat, repeat-x, repeat-y,no-repeat.
  • 14. Canvas Translate ● context.translate(dx,dy); ● context.scale(dx, dy); ● context.rotate(d); ● context.transform(a, b, c, d, e, f); ● context.save(); / context.restore();
  • 15. other ● Shadow – context.shadowColor = '#999'; – context.shadowBlur = 20; – context.shadowOffsetX = 15; – context.shadowOffsetY = 15; ● context.globalAlpha = 0.5; ● context.clip();
  • 16. ?
  • 17. ● Analyze sample game wite by js