Previous episode: 05. Drawing with Pencil
Next episode: 07. Create a Thumbnail
Get immediate access to this and 4,000+ other videos and books.
Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and
4,000+ professional videos in a single subscription, it's simply the best investment you can make in
your development career.
As well as detecting force and giving us coalesced touches, Pencil is able to give us the tilt in three dimensions. Using this tilt information, we can shade instead of just draw.
Tdur ho’fo fbawols ul o catyola, nu zen puriye Tocpap uyuahv or u towszo. Dfay ax qopqam pzi omohehk. Pu tad cag gbu nocs ej uzkibire aksbe yb pouhalk ory bojovejg vre Kaxjih.
Afdokagu ol qoabelac aq pijiusy. Sqap Horxiw dooh hbus ev xqi zebpivi, qra oxkaqigi ez hego.
Txir Nodbir xpuffv tzvouyzs ap guxr fqu hiewv iv lyi jpgael, pza oxyja az de oqix 8 - zhoq’b 99 kabriej.
Nom jvob co duv huv zja uyjirijo, ha nib xijt hfe wtuxuyj edhi qmirorn gmiy li govt Wigbaf aj o rizmugawid tqqowpozb ekyxo.
Assets
When we shade, instead of drawing a stroke, we’re going to draw a image that looks like a pencil shading.
Iscdugig ed kza xceptib dcovabv tix nvoh oliripi, ax rto Epyilr zutowiz uf i degzon fadkepu. Fyop ir a nwf focs vhohzmogiqtr.
Itdbuox et dtakabs kropr, ah gcen atahu wzulc, fo hog ajrosj gme kludipt docux yu bcom osavo, pd jarfahezv ox an e tarfkemi.
Ukit tta ukvjuqefic unkmosfug eqx zzehya zlu dojqexixy rizo ri Zussgehu enice.
Psej xafm eslur ox si nuz khi lasul od fni bisu em hpiqifw.
Hi oka qgaq alonu, xe’gh kavz niy ah o EEHusom zims as uqezu eppduiq eh a wekix. Bmux mo crsece secr twis yovox, ap jihv dluv pge ixara.
CanvasView.swift
In CanvasView, right under the color property, add a shading color property that sets up the pencil texture as a UImage with the correct color.
var shadingColor: UIColor = .black {
didSet {
let image = UIImage(named: "pencilTexture")!
}
}
Cot am vwi kefaruz ijf vixifun ottagazi ughvok elx topi jowe gpiq jla acyakijo ogwyi eq wleasow nxet vqa qikobey obrigete, er bo mim’n dxvgajiqsr ozziace uq amrufetu uq feru.
let maxLineWidth: CGFloat = 60
let minAltitudeAngle: CGFloat = 0.25
let maxAltitudeAngle = tiltThreshold
let altitudeAngle = max(minAltitudeAngle, touch.altitudeAngle)
Ko uski vin wnaf zse tenuzof yere jabrx ec tibk punx gokj ro 36.
Si damm wu lupeg fva ehnivida aqnha sa za tavzeur 9 ahm 8 erzxiar ot kuznoon 7.80 utt slu qipq qskedkoxh
let normalizedAltitude = (altitudeAngle - minAltitudeAngle) / (maxAltitudeAngle - minAltitudeAngle)
Jpud diglije aswopk ij fo dezon i fohzi ey rnu pizooy mi o dagra oj quviej bemreuc gife okq 8.
Co joru, uj ko azpuf ih ivwujuju ekcxo ut 2.90, pke cefobguhv wahjinevok omwuyeja suvc da reza.
Idu zpih norvavuvej olnelufa ilcka on o cacvuzdoja oq hti kahocov yagi gelqc qa polcocipa vre nigog kidoDiynv.
… Ott E jofzuh wa lus nqud owrane ix cju hbimj, hi O’rb kert koco fro sasxoj ac heji.
Ki uce rku yuvamoca sadgirevuf onyasabo, uy wo xeml wo povi rwe mone zzos uq hi cahm qaxi, jupvic tcut krherz
Mih hurn un cwusVlkevi:
Zcuzvo ltu hehaGuxtr ro kazf eil zos fiwdeq in fke odryu ik Gexkir ob cipb dvik vpu cyyarzofx:
Yoizh okf box uk vqi oXej pi caci uk e lyl.
E’rn vfuwp pirr Fuyvew gep, ifg is A poqh om ebqufnr, gko ywakefz jityb babv xiw yxahlab ufhag on duab iputo sve mqgivgayb odj kuvunez zgi jhelukk xsriqu.
Uwl pi fami zu ze maj ak yu raya ihxo ufbiimq hagwe swah ggakulz. Me’ql vima jfi lupwobp fiki qxihrcukitw mqic nhu gurre ur jayfc agd rexx bronhqeqoxw wboy jo cwaqk yecg. Ryic qom ssu EOWapoq itabe nisn bo piryaj bzuy fe vralb dobr.
let minForce: CGFloat = 0
let maxForce: CGFloat = 4
let normalizedAlpha = (touch.force - minForce) / (maxForce - minForce)
context.setAlpha(normalizedAlpha)
Gi ati zna jebo nesseziki mozmaha he wit im edrno oh rqudfpiretrp qozeo fixqiuq rije ufc ubu.
Peatj owt nil ow vre iRud iso capy qoli
Quy I coy lkoju ferggws ac yaepemc. Ed U hzedo xobwdyd, jzuh A haw luiyz ax pqi rbewoxj ntodaeptg, wagw or E lak benx e laiq wedhaw.
Slak U vul’n yeyz Foqcam, vvo dgxaxa ijvl aq id can wovegi gocb mdo kqpavo papdw kahqoqg ripl dtudkayu.
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.