SlideShare a Scribd company logo
1 of 21
Download to read offline
Optical alignment
in user interfaces
For frontend developers
Ivan Grekov 2018-03-15
Alignment of two
layers in icons
● Simple icons with background of
different shapes,
● icons consisted of 2 shapes,
● icons with sufficient paddings
inside main container
Transfer from geometric to optical alignment
Optical imbalance
Caused by geometric alignment
Can be fixed with optical alignment
Defining problem
Geometric alignment Optical alignment
Typical algorithm
For geometric
alignment
● Definition of center of first shape
● Definition of center of second shape
● Comparison of centers
● Implementation.
Typical algorithm
For geometric
alignment
● Definition of center of first shape
● Definition of center of second shape
● Comparison of centers
● Implementation.
Typical algorithm
For geometric
alignment
● Definition of center of first shape
● Definition of center of second shape
● Comparison of centers
● Implementation.
Typical algorithm
For geometric
alignment
● Definition of center of first shape
● Definition of center of second shape
● Comparison of centers
● Implementation.
The solution is clear
Define center of shapes properly
Optical alignment
It helps us to define proper center of shapes
Javascript + maths = optical alignment
Implementation of solution
“ - For frontend developers
We will use simple formula
Formula for finding centroid of polygon
We need to integrate it in project
and make use of it auto & simple
Algorithm
For optical
alignment
● Definition of center of first shape
● Definition of geometric center of
second shape
● Definition of optical center of second
shape
● Comparison of centers
● Implementation of new position for one
of the shapes.
Algorithm
For optical
alignment
● Definition of center of first shape
● Definition of geometric center of
second shape
● Definition of optical center of second
shape
● Comparison of centers
● Implementation of new position for one
of the shapes.
Algorithm
For optical
alignment
● Definition of center of first shape
● Definition of geometric center of
second shape
● Definition of optical center of second
shape
● Comparison of centers
● Implementation of new position for one
of the shapes.
Algorithm
For optical
alignment
● Definition of center of first shape
● Definition of geometric center of
second shape
● Definition of optical center of second
shape
● Comparison of centers
● Implementation of new position for one
of the shapes.
Algorithm
For optical
alignment
● Definition of center of first shape
● Definition of geometric center of
second shape
● Definition of optical center of second
shape
● Comparison of centers
● Implementation of new position for
one of the shapes.
Before After
Optical alignment algorithm
● loop iteration for each svg layer.
● loop iteration for each svg path on layer.
● loop iteration for each point in svg path.
● get area of svg path.
● get centroid for it.
● visualize new center of shape on screen.
With help of Javascript
It is much easier
Existing ready to go solutions - plugins for graphic editors:
1. Photoshop
○ https://gist.github.com/Winner95/0cdf485bf45a04dbc6fd63afdc7836
21
2. Sketch
○ http://sketchhunt.com/2016/06/02/optically-sketch-plugin-automated-
optical-adjustments-mathematical-precision/
3. D3.js - centroid
○ https://github.com/d3/d3-polygon/blob/master/src/centroid.js#L1
4. Offline-Events:
○ BeerJS - https://www.meetup.com/BeerJS-London/events/248742436/
5. Your favorite JS web-resources =)
This method has limits
● no intersections inside aligned shapes
● Gradient backgrounds are not
considered
● Similar colours of shapes aligned not
considered
● Two layers aligned to each other.
Optical alignment
Main benefits
● It solves problem.
● No additional maintenance
● No need in additional design iterations
● Easy to implement, easy to use
Optical alignment
With help of Javascript
You can do more:
● Extend shown solution, make it usable for
multi-layer icons, icons with cuts, etc
● Integrate optical alignment in process of
continuous deployment as a test or as a auto
tool with help of D3.JS function centroid
Thank you!
● ivan.grekov@corp.badoo.com
● twitter.com/igrekov
● facebook.com/iigrekov

More Related Content

Similar to Optical alignment - Ivan Grekov

Computer Aided Design visual realism notes
Computer Aided Design visual realism notesComputer Aided Design visual realism notes
Computer Aided Design visual realism notes
KushKumar293234
 

Similar to Optical alignment - Ivan Grekov (20)

Two marks with answers ME6501 CAD
Two marks with answers ME6501 CADTwo marks with answers ME6501 CAD
Two marks with answers ME6501 CAD
 
3D Reconstruction from Multiple uncalibrated 2D Images of an Object
3D Reconstruction from Multiple uncalibrated 2D Images of an Object3D Reconstruction from Multiple uncalibrated 2D Images of an Object
3D Reconstruction from Multiple uncalibrated 2D Images of an Object
 
ME6501 Cad 2 mark question and answer
ME6501 Cad 2 mark question and answerME6501 Cad 2 mark question and answer
ME6501 Cad 2 mark question and answer
 
iv10_linear_pose.pptx
iv10_linear_pose.pptxiv10_linear_pose.pptx
iv10_linear_pose.pptx
 
DTAM: Dense Tracking and Mapping in Real-Time, Robot vision Group
DTAM: Dense Tracking and Mapping in Real-Time, Robot vision GroupDTAM: Dense Tracking and Mapping in Real-Time, Robot vision Group
DTAM: Dense Tracking and Mapping in Real-Time, Robot vision Group
 
Photomodeler
PhotomodelerPhotomodeler
Photomodeler
 
ViT.pptx
ViT.pptxViT.pptx
ViT.pptx
 
1 Sketcher
1 Sketcher1 Sketcher
1 Sketcher
 
Graph-based SLAM
Graph-based SLAMGraph-based SLAM
Graph-based SLAM
 
JDK and AWT
JDK and AWTJDK and AWT
JDK and AWT
 
Image classification using neural network
Image classification using neural networkImage classification using neural network
Image classification using neural network
 
Computer Vision panoramas
Computer Vision  panoramasComputer Vision  panoramas
Computer Vision panoramas
 
Computer Vision - Alignment and Tracking.pptx
Computer Vision - Alignment and Tracking.pptxComputer Vision - Alignment and Tracking.pptx
Computer Vision - Alignment and Tracking.pptx
 
Vector-Valued Functions and GeoGebra
Vector-Valued Functions and GeoGebraVector-Valued Functions and GeoGebra
Vector-Valued Functions and GeoGebra
 
Medial Axis Transformation based Skeletonzation of Image Patterns using Image...
Medial Axis Transformation based Skeletonzation of Image Patterns using Image...Medial Axis Transformation based Skeletonzation of Image Patterns using Image...
Medial Axis Transformation based Skeletonzation of Image Patterns using Image...
 
PCA-SIFT: A More Distinctive Representation for Local Image Descriptors
PCA-SIFT: A More Distinctive Representation for Local Image DescriptorsPCA-SIFT: A More Distinctive Representation for Local Image Descriptors
PCA-SIFT: A More Distinctive Representation for Local Image Descriptors
 
The kinematics analysis and trajectory planning of Series robot
The kinematics analysis and trajectory planning of Series robotThe kinematics analysis and trajectory planning of Series robot
The kinematics analysis and trajectory planning of Series robot
 
[CVPR2020] Simple but effective image enhancement techniques
[CVPR2020] Simple but effective image enhancement techniques[CVPR2020] Simple but effective image enhancement techniques
[CVPR2020] Simple but effective image enhancement techniques
 
Computer Aided Design visual realism notes
Computer Aided Design visual realism notesComputer Aided Design visual realism notes
Computer Aided Design visual realism notes
 
Notes04.pdf
Notes04.pdfNotes04.pdf
Notes04.pdf
 

More from FrontEnders (8)

Intro to the Intersection Observer API - Tara Ojo
Intro to the Intersection Observer API - Tara OjoIntro to the Intersection Observer API - Tara Ojo
Intro to the Intersection Observer API - Tara Ojo
 
Accessible client side routing - Nick Colley
Accessible client side routing - Nick ColleyAccessible client side routing - Nick Colley
Accessible client side routing - Nick Colley
 
Where are the women? - Dora Militaru
Where are the women? - Dora MilitaruWhere are the women? - Dora Militaru
Where are the women? - Dora Militaru
 
React all the things - Milos Popovic
React all the things - Milos PopovicReact all the things - Milos Popovic
React all the things - Milos Popovic
 
Adventures with pattern libraries - Chris Gibbons
Adventures with pattern libraries - Chris GibbonsAdventures with pattern libraries - Chris Gibbons
Adventures with pattern libraries - Chris Gibbons
 
Henry Charge - It's your job to make things accessible
Henry Charge - It's your job to make things accessibleHenry Charge - It's your job to make things accessible
Henry Charge - It's your job to make things accessible
 
Rebecca Topps - Mobile Accessibility
Rebecca Topps - Mobile AccessibilityRebecca Topps - Mobile Accessibility
Rebecca Topps - Mobile Accessibility
 
Jonathan Hassell - The past, present and future of accessibility
Jonathan Hassell - The past, present and future of accessibilityJonathan Hassell - The past, present and future of accessibility
Jonathan Hassell - The past, present and future of accessibility
 

Recently uploaded

Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
FIDO Alliance
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc
 

Recently uploaded (20)

The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
Top 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTop 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development Companies
 
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptxCyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
 
Generative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfGenerative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdf
 
الأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهلهالأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهله
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!
 
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdfFrisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overview
 
Event-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingEvent-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream Processing
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate Guide
 
How to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfHow to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cf
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch Tuesday
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptx
 

Optical alignment - Ivan Grekov

  • 1. Optical alignment in user interfaces For frontend developers Ivan Grekov 2018-03-15
  • 2. Alignment of two layers in icons ● Simple icons with background of different shapes, ● icons consisted of 2 shapes, ● icons with sufficient paddings inside main container Transfer from geometric to optical alignment
  • 3. Optical imbalance Caused by geometric alignment Can be fixed with optical alignment Defining problem Geometric alignment Optical alignment
  • 4. Typical algorithm For geometric alignment ● Definition of center of first shape ● Definition of center of second shape ● Comparison of centers ● Implementation.
  • 5. Typical algorithm For geometric alignment ● Definition of center of first shape ● Definition of center of second shape ● Comparison of centers ● Implementation.
  • 6. Typical algorithm For geometric alignment ● Definition of center of first shape ● Definition of center of second shape ● Comparison of centers ● Implementation.
  • 7. Typical algorithm For geometric alignment ● Definition of center of first shape ● Definition of center of second shape ● Comparison of centers ● Implementation.
  • 8. The solution is clear Define center of shapes properly
  • 9. Optical alignment It helps us to define proper center of shapes
  • 10. Javascript + maths = optical alignment Implementation of solution “ - For frontend developers
  • 11. We will use simple formula Formula for finding centroid of polygon We need to integrate it in project and make use of it auto & simple
  • 12. Algorithm For optical alignment ● Definition of center of first shape ● Definition of geometric center of second shape ● Definition of optical center of second shape ● Comparison of centers ● Implementation of new position for one of the shapes.
  • 13. Algorithm For optical alignment ● Definition of center of first shape ● Definition of geometric center of second shape ● Definition of optical center of second shape ● Comparison of centers ● Implementation of new position for one of the shapes.
  • 14. Algorithm For optical alignment ● Definition of center of first shape ● Definition of geometric center of second shape ● Definition of optical center of second shape ● Comparison of centers ● Implementation of new position for one of the shapes.
  • 15. Algorithm For optical alignment ● Definition of center of first shape ● Definition of geometric center of second shape ● Definition of optical center of second shape ● Comparison of centers ● Implementation of new position for one of the shapes.
  • 16. Algorithm For optical alignment ● Definition of center of first shape ● Definition of geometric center of second shape ● Definition of optical center of second shape ● Comparison of centers ● Implementation of new position for one of the shapes. Before After
  • 17. Optical alignment algorithm ● loop iteration for each svg layer. ● loop iteration for each svg path on layer. ● loop iteration for each point in svg path. ● get area of svg path. ● get centroid for it. ● visualize new center of shape on screen.
  • 18. With help of Javascript It is much easier Existing ready to go solutions - plugins for graphic editors: 1. Photoshop ○ https://gist.github.com/Winner95/0cdf485bf45a04dbc6fd63afdc7836 21 2. Sketch ○ http://sketchhunt.com/2016/06/02/optically-sketch-plugin-automated- optical-adjustments-mathematical-precision/ 3. D3.js - centroid ○ https://github.com/d3/d3-polygon/blob/master/src/centroid.js#L1 4. Offline-Events: ○ BeerJS - https://www.meetup.com/BeerJS-London/events/248742436/ 5. Your favorite JS web-resources =)
  • 19. This method has limits ● no intersections inside aligned shapes ● Gradient backgrounds are not considered ● Similar colours of shapes aligned not considered ● Two layers aligned to each other. Optical alignment
  • 20. Main benefits ● It solves problem. ● No additional maintenance ● No need in additional design iterations ● Easy to implement, easy to use Optical alignment With help of Javascript You can do more: ● Extend shown solution, make it usable for multi-layer icons, icons with cuts, etc ● Integrate optical alignment in process of continuous deployment as a test or as a auto tool with help of D3.JS function centroid
  • 21. Thank you! ● ivan.grekov@corp.badoo.com ● twitter.com/igrekov ● facebook.com/iigrekov