π€
Shapy: Images with CSS Gradients & Vue.js π€ π¨ Victoria Bergquist, @vicbergquist Vue Conf Toronto, November 15 2018
Slide 2
Victoria Bergquist, who? π¦ Front End Dev & Community Manager @melsicon π’ CSS Frankfurt & Vue.js Frankfurt πΊ Vue Vixens DE π¦ Cats & M&Ms β€ (donations welcome) @vicbergquist Vue Conf Toronto
Slide 3
What is Shapy? π§ A CSS gradients generator + more
)
Play around with gradients
+
Be a CSS artist
β
Copy code (like a pro)
@vicbergquist Vue Conf Toronto
Slide 4
Pre-talk demo! π± Letβs see what Shapy is!
@vicbergquist Vue Conf Toronto
Origin π #DailyCSSImages Daily e-mail prompts to make CSS images
@vicbergquist Vue Conf Toronto
Slide 7
Origin π #DailyCSSImages
Level 1: One tag per shape
@vicbergquist Vue Conf Toronto
Slide 8
Origin π #DailyCSSImages
Level 2: Fewer tag + Pseudo elements
@vicbergquist Vue Conf Toronto
Slide 9
Origin π #DailyCSSImages
God level: One tag + pseudo elements + gradients a.singlediv.com by Lynn Fisher
@vicbergquist Vue Conf Toronto
Slide 10
Origin π
π±
π±
CSS only
CSS only
What kind of magic is this? π @vicbergquist Vue Conf Toronto
Slide 11
Origin π
π±
π± wtf π° @vicbergquist Vue Conf Toronto
Slide 12
Origin π Thereβs a generator for that, right? I donβt know π€·
@vicbergquist Vue Conf Toronto
Slide 13
Origin π A year later: I still donβt know.
π
But letβs just make one!
@vicbergquist Vue Conf Toronto
Slide 14
Origin π But JavaScript π
But Vue.js! π
@vicbergquist Vue Conf Toronto
Slide 15
Origin π But JavaScript π
4π Slow progressβ¦
@vicbergquist Vue Conf Toronto
Slide 16
Origin π
@vicbergquist Vue Conf Toronto
Slide 17
Origin π
But Vue.js π
@vicbergquist Vue Conf Toronto
Slide 18
Origin π But Vue.js π
Gentle & Supportive
π¦ Makes all your ideas come true!
productivity++ @vicbergquist Vue Conf Toronto
Slide 19
Origin π
I WAS ON A ROLL π @vicbergquist Vue Conf Toronto
Slide 20
The How π― Learn how CSS gradients work: background-color background-image background-position
Shorthand:
background
background-repeat background-size + more
@vicbergquist Vue Conf Toronto
Slide 21
The How π― Learn how CSS gradients work radial-gradient(
linear-gradient(
Width Height at X-axis Y-axis,
Direction,
Color start, Color stop)
Color start, Color stop)
no-repeat
no-repeat
X-axis Y-axis / Width Height
X-axis Y-axis / Width Height)
@vicbergquist Vue Conf Toronto
Slide 22
The How π― What did I use to build Shapy? Vuex
vuex-map-fields vue-meta
vue-color
vue-highlightjs (vue-router)
@vicbergquist Vue Conf Toronto
Slide 23
The How π― Gather your data: input fields in a form x 1000. V-model everything!
@vicbergquist Vue Conf Toronto
Slide 24
The How π― Gather your data: update the store on changes
@vicbergquist Vue Conf Toronto
Slide 25
The How π― Turn it into a string ${type}( ${shape}, ${repeat} ${colors}) ${box}
@vicbergquist Vue Conf Toronto
Slide 26
The How π― Turn it into a string gradientString() { // TYPE const type = this.general.type // REPEATING const repeat = this.general.repeat // COLORS const colors = this.colorStops // COMMENT const comment = this.general.comment // DEGREE const degree = this.general.degree.size + this.general.degree.unit // BOX const box = this.boxCombined // SHAPE const shape = this.shapeCombined
}
if (type === 'radial-gradient') { return /* ${comment} */ ${type}(${shape}, ${colors}) ${repeat} ${box} } else if (type === 'linear-gradient' && this.general.degree.size > 0) { return /* ${comment} */ ${type}(${degree}, ${colors}) ${repeat} ${box} } else if (type === 'linear-gradient') { return /* ${comment} */ ${type}(${colors}) ${repeat} ${box} }
@vicbergquist Vue Conf Toronto
Slide 27
The How π― Turn it into a string radial-gradient( 50% 50% at 50% 50%, #00978d 0%, #f3b6c9 100%) no-repeat 50% 50% / 100% 100%
linear-gradient( 90deg, #00978d 0%, #f3b6c9 100%) no-repeat 50% 50% / 100% 100%
@vicbergquist Vue Conf Toronto
Slide 28
The How π― Bind the style! <div class=βcanvasβ :style=β{ background: gradientString }β/>
π
π @vicbergquist Vue Conf Toronto
Slide 29
Demo time! Letβs make the Vue logo together!
@vicbergquist Vue Conf Toronto
Slide 30
Shapyβs Future π§ Plans and ideas for Shapy
)
Gallery: like/fork/share
π¦
Shapy in the browser
π‘ Your ideas?
@vicbergquist Vue Conf Toronto
Slide 31
π€
Play with Shapy
shapy.app β€ Contribute to Shapy
github.com/vicbergquist/shapy @vicbergquist Vue Conf Toronto